home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / SNNSV32.ZIP / SNNSv3.2 / xgui / sources / bn_bignet.ph < prev    next >
Encoding:
Text File  |  1994-04-25  |  7.3 KB  |  263 lines

  1. /*****************************************************************************
  2.   FILE           : bn_bignet.ph
  3.   SHORTNAME      : bn_bignet
  4.   SNNS VERSION   : 3.2
  5.  
  6.   PURPOSE        : 
  7.   NOTES          :
  8.  
  9.   AUTHOR         : Michael Schmalzl  
  10.   DATE           : 1.4.1990
  11.  
  12.   CHANGED BY     : Sven Doering, Kai-Uwe Herrmann
  13.   IDENTIFICATION : @(#)bn_bignet.ph    1.9 3/2/94
  14.   SCCS VERSION   : 1.9
  15.   LAST CHANGE    : 3/2/94
  16.  
  17.              Copyright (c) 1990-1994  SNNS Group, IPVR, Univ. Stuttgart, FRG
  18.  
  19. ******************************************************************************/
  20. #ifndef _BN_BIGNET_DEFINED_
  21. #define  _BN_BIGNET_DEFINED_
  22.  
  23.  
  24.  
  25. /* begin global definition section */
  26.  
  27. void bn_createBignet (void);
  28.  
  29. /* end global definition section */
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36. /* begin private definition section */
  37.  
  38. #define BN_RIGHT  0
  39. #define BN_BELOW  1
  40. #define BN_LEFT   2
  41.  
  42. #define BN_INPUT 0
  43. #define BN_OUTPUT 1
  44. #define BN_HIDDEN 2
  45.  
  46. #define SOURCE_PLANE 1
  47. #define SOURCE_CLUSTER 3
  48. #define SOURCE_UNIT 5
  49.  
  50. #define TARGET_PLANE 8
  51. #define TARGET_CLUSTER 17
  52. #define TARGET_UNIT 33
  53.  
  54. #define PLANE_TO_PLANE 9
  55. #define PLANE_TO_CLUSTER 26
  56. #define PLANE_TO_UNIT 42
  57. #define CLUSTER_TO_PLANE 12
  58. #define CLUSTER_TO_CLUSTER 29
  59. #define CLUSTER_TO_UNIT 45
  60. #define UNIT_TO_PLANE 14
  61. #define UNIT_TO_CLUSTER 31
  62. #define UNIT_TO_UNIT 47
  63.  
  64. #define bn_widget_output(string) ((strcmp("0",string)==0) ? ("") : (string))
  65.  
  66. static int BN_ERROR=0;
  67.  
  68. typedef struct plane {
  69.   int width;
  70.   int height;
  71.   int pos;
  72.   int type;
  73.   int begin;
  74.   struct plane *next;
  75.   struct plane *before;
  76. } PLANE;
  77.  
  78. static char *plane_pos[] = {"right","below","left"};
  79. static char *plane_type[] = {"input","output","hidden"};
  80.  
  81. static PLANE *PLANE_current_element = NULL;
  82. static PLANE *PLANE_first_element = NULL;
  83. static PLANE *PLANE_last_element = NULL;
  84.  
  85. static int   PLANE_length = 0;
  86. static int   PLANE_no = 0;
  87. static int   PLANE_pos = BN_RIGHT;
  88. static int   PLANE_type = BN_INPUT;
  89.  
  90. static int PLANE_width,PLANE_height;
  91.  
  92. typedef struct link {
  93.   struct {
  94.     int plane;
  95.     struct {
  96.       int x;
  97.       int y;
  98.       int width;
  99.       int height;
  100.     } CLUSTER;
  101.     struct {
  102.       int x;
  103.       int y;
  104.     } UNIT;
  105.     struct {
  106.       int delta_x;
  107.       int delta_y;
  108.     } MOVE;
  109.   } SOURCE;
  110.   struct {
  111.     int plane;
  112.     struct {
  113.       int x;
  114.       int y;
  115.       int width;
  116.       int height;
  117.     } CLUSTER;
  118.     struct {
  119.       int x;
  120.       int y;
  121.     } UNIT;
  122.     struct {
  123.       int delta_x;
  124.       int delta_y;
  125.     } MOVE;
  126.   } TARGET;
  127.   int type_of_connection;
  128.   int move;
  129.   struct link *before;
  130.   struct link *next;
  131. } LINK;
  132.  
  133. static LINK *LINK_current_element = NULL;
  134. static LINK *LINK_first_element = NULL;
  135. static LINK *LINK_last_element = NULL;
  136.  
  137. static int LINK_length=0;
  138.  
  139. static int LINK_move,LINK_type_of_connection;
  140.  
  141. static int LINK_source_move_delta_x,LINK_source_move_delta_y,LINK_target_move_delta_x,LINK_target_move_delta_y;
  142.  
  143. static int LINK_source_plane,LINK_source_cluster_x,LINK_source_cluster_y,LINK_source_cluster_width,
  144.     LINK_source_cluster_height,LINK_source_unit_x,LINK_source_unit_y;
  145.  
  146. static int LINK_target_plane,LINK_target_cluster_x,LINK_target_cluster_y,LINK_target_cluster_width,
  147.     LINK_target_cluster_height,LINK_target_unit_x,LINK_target_unit_y;
  148.  
  149. #define bn_fontWidth 8
  150.  
  151. static int bignet_widget_open = 0;
  152.  
  153. static int bn_intWidth = 6 * bn_fontWidth;
  154.  
  155.  
  156. static Widget baseWidget;
  157. static Widget z1s1,z1s2,z1s3,z2s1,z3s1,z4s1,z5s1,z6s1,z7s1;
  158.  
  159. static Widget z2s2,z2s3,z3s2,z3s3,z4s2,z4s3,
  160.        z5s2,z5s3,z6s2,z6s3,z7s2,z7s3;
  161.  
  162.  
  163. static Widget z8s2,z8s3,z9s1,z9s2,z9s3,z9s4,z10s1,z11s1,z12s1,z13s1,z14s1,z15s1,z16s1,z17s1;
  164. static Widget z18s1,z19s1,z20s1,z21s1,z22s1,z23s1;
  165.  
  166. static Widget z10s2,z10s3,z10s4,z10s5,z13s2,z13s3,z13s4,z13s5,z14s2,z14s3,z14s4,z14s5;
  167. static Widget z15s2,z15s3,z15s4,z15s5,z16s2,z16s3,z16s4,z16s5,z17s2,z17s3,z17s4,z17s5;
  168. static Widget z18s2,z18s3,z18s4,z18s5,z19s2,z19s3,z19s4,z19s5,z20s2,z20s3,z20s4,z20s5;
  169. static Widget z22s2,z22s3,z22s4,z22s5,z23s2,z23s3,z23s4,z23s5;
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176. /* bn_bignet */
  177. static void bn_createPlanePannel (Widget parent);
  178. static void bn_createLinkPannel (Widget parent);
  179. static void exit_PROC (void);
  180.  
  181. /* bn_create_net */
  182. static void create_net_PROC(void);
  183. static void calculate_first_snns_unit_no_of_plane(void);
  184. static int calculate_x_begin(int *new_x_begin,int *old_x_begin,int *x_max,int width,int pos);
  185. static int calculate_y_begin(int *absolute_y_max,int *relative_y_max,int *y_offset,int height,int pos);
  186. static void create_snns_unit(void);
  187. static void make_link(PLANE *LINK_source_plane,int LINK_source_cluster_x,int LINK_source_cluster_y,
  188.                int LINK_source_cluster_width,int LINK_source_cluster_height,
  189.                PLANE *LINK_target_plane,int LINK_target_cluster_x,int LINK_target_cluster_y,
  190.                int LINK_target_cluster_width,int LINK_target_cluster_height);
  191. static void make_move_link(PLANE *LINK_source_plane,int LINK_source_cluster_x,int LINK_source_cluster_y,
  192.                     int LINK_source_cluster_width,int LINK_source_cluster_height,
  193.             PLANE * LINK_target_plane,int LINK_target_cluster_x,int LINK_target_cluster_y,
  194.                     int LINK_target_cluster_width,int LINK_target_cluster_height,
  195.                     int LINK_source_move_delta_x,int LINK_source_move_delta_y,
  196.                     int LINK_target_move_delta_x,int LINK_target_move_delta_y);
  197. static int move_p(PLANE *plane_no,int *y,int *x,int width,int height,int x_pivot,int x_step,int y_step);
  198. static void bn_display_net(void);
  199.  
  200. /* bn_link */
  201.  
  202. static int read_link_elements(void);
  203. static void write_current_link(void);
  204. static void clear_current_link(void);
  205. static void write_current_link_to_editor(void);
  206. static void clear_edit_link(void);
  207. static void enter_link_PROC(void);
  208. static void full_connection_PROC(void);
  209. static void shortcut_connection_PROC(void);
  210. static void overwrite_link_PROC(void);
  211. static void delete_link_PROC(void);
  212. static void forward_link_PROC(void);
  213. static void backward_link_PROC(void);
  214. static void end_link_PROC(void);
  215. static void beginning_link_PROC(void);
  216. static void current_link_to_editor_PROC(void);
  217. static int correct_link_input(void);
  218. static void enter_link(void);
  219. static int full_connection(void);
  220. static int shortcut_connection(void);
  221. static void overwrite_link(void);
  222. static void delete_current_link(void);
  223. static void get_links_and_delete_them(int plane_no);
  224. static int forward_link(void);
  225. static int backward_link(void);
  226. static int beginning_link(void);
  227. static int end_link(void);
  228.  
  229. /* bn_plane */
  230.  
  231. static int read_plane_elements(void);
  232. static void write_current_plane(void);
  233. static void clear_current_plane(void);
  234. static void write_current_plane_to_editor(void);
  235. static void clear_edit_plane(void);
  236. static void cancel_net_PROC(void);
  237. static void enter_plane_PROC(void);
  238. static void insert_plane_PROC(void);
  239. static void overwrite_plane_PROC(void);
  240. static void delete_plane_PROC(void);
  241. static void forward_plane_PROC(void);
  242. static void backward_plane_PROC(void);
  243. static void end_plane_PROC(void);
  244. static void beginning_plane_PROC(void);
  245. static void pos_PROC(void);
  246. static void current_plane_to_editor_PROC(void);
  247. static void type_PROC(void);
  248. static void enter_plane(void);
  249. static void insert_plane(void);
  250. static void overwrite_plane(void);
  251. static void delete_current_plane(void);
  252. static int forward_plane(void);
  253. static int backward_plane(void);
  254. static int beginning_plane(void);
  255. static int end_plane(void);
  256. static PLANE *get_plane(int plane_no);
  257.  
  258. /* end private definition section */
  259.  
  260. #endif 
  261. /* end of file */
  262. /* lines: 255 */
  263.